home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2006 May / PCWMAY06.iso / Software / Freeware / First Page 2006 3.00 / fp2006-final-3.00-setup.exe / {app} / Iscripts / Forms Misc / disable-form.izs < prev    next >
Text File  |  2005-09-28  |  3KB  |  115 lines

  1. <!NOWIZARD>
  2.  
  3. <!TITLE>Disable Submit
  4. <!/TITLE>
  5.  
  6. <!DESCRIPTION>This form prevent somebody repeatedly submiting forms, by disabling the submit and reset buttons after being pressed once!<!/DESCRIPTION> 
  7.  
  8. <!CATEGORY>Forms<!/CATEGORY>
  9.  
  10. <!SCRIPT>
  11. <!-- START OF SCRIPT -->
  12.  
  13.  
  14. <!-- HOW TO INSTALL DISABLE SUBMIT:
  15.  
  16.   1.  Copy code into the HEAD section of document
  17.   2.  Put last coding into the BODY section of document  -->
  18.  
  19. <!-- STEP ONE: Add code into HEAD section of document  -->
  20.  
  21. <HEAD>
  22.  
  23. <SCRIPT LANGUAGE="JavaScript">
  24. <!-- Web Site:  http://dynamicdrive.com -->
  25.  
  26.  
  27. <!-- Begin
  28. function disableForm(theform) {
  29. if (document.all || document.getElementById) {
  30. for (i = 0; i < theform.length; i++) {
  31. var tempobj = theform.elements[i];
  32. if (tempobj.type.toLowerCase() == "submit" || tempobj.type.toLowerCase() == "reset")
  33. tempobj.disabled = true;
  34. }
  35. setTimeout('alert("Your form has been submitted.  Notice how the submit and reset buttons were disabled upon submission.")', 2000);
  36. return true;
  37. }
  38. else {
  39. alert("The form has been submitted.  But, since you're not using IE 4+ or NS 6, the submit button was not disabled on form submission.");
  40. return false;
  41.    }
  42. }
  43. //  End -->
  44. </script>
  45. </HEAD>
  46.  
  47. <!-- STEP TWO: Add code into BODY section of document  -->
  48.  
  49. <BODY>
  50.  
  51. <center>
  52. <form onSubmit="return disableForm(this);">
  53. Name: <input type=text name=person>
  54. <input type=submit><input type=reset>
  55. </form>
  56. </center>
  57.  
  58.  
  59. <!-- END OF SCRIPT -->
  60. <!/SCRIPT>
  61.  
  62. <!PREVIEW>
  63. <!-- START OF SCRIPT -->
  64.  
  65.  
  66. <!-- HOW TO INSTALL DISABLE SUBMIT:
  67.  
  68.   1.  Copy code into the HEAD section of document
  69.   2.  Put last coding into the BODY section of document  -->
  70.  
  71. <!-- STEP ONE: Add code into HEAD section of document  -->
  72.  
  73. <HEAD>
  74.  
  75. <SCRIPT LANGUAGE="JavaScript">
  76. <!-- Web Site:  http://dynamicdrive.com -->
  77.  
  78.  
  79. <!-- Begin
  80. function disableForm(theform) {
  81. if (document.all || document.getElementById) {
  82. for (i = 0; i < theform.length; i++) {
  83. var tempobj = theform.elements[i];
  84. if (tempobj.type.toLowerCase() == "submit" || tempobj.type.toLowerCase() == "reset")
  85. tempobj.disabled = true;
  86. }
  87. setTimeout('alert("Your form has been submitted.  Notice how the submit and reset buttons were disabled upon submission.")', 2000);
  88. return true;
  89. }
  90. else {
  91. alert("The form has been submitted.  But, since you're not using IE 4+ or NS 6, the submit button was not disabled on form submission.");
  92. return false;
  93.    }
  94. }
  95. //  End -->
  96. </script>
  97. </HEAD>
  98.  
  99. <!-- STEP TWO: Add code into BODY section of document  -->
  100.  
  101. <BODY>
  102.  
  103. <center>
  104. <form onSubmit="return disableForm(this);">
  105. Name: <input type=text name=person>
  106. <input type=submit><input type=reset>
  107. </form>
  108. </center>
  109.  
  110.  
  111. <!-- END OF SCRIPT -->
  112. <!/PREVIEW>
  113.  
  114. <!RELATED>NONE<!/RELATED>
  115.